<%@page import="cn.hello2018.entity.Profit"%>
<%@page import="java.util.List"%>
<%@ page language="java" contentType="text/html; charset=UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>原生态JAVA生成报表</title>
<style type="text/css">
table.hovertable {
	font-family: verdana, arial, sans-serif;
	font-size: 13px;
	color: #333333;
	border-color: #999999;
	border-collapse: collapse;
}

table.hovertable th {
	background-color: #c3dde0;
	border-width: 1px;
	padding: 8px;
	border-style: solid;
	border-color: #o9c6c9;
}

table.hovertable tr {
	background-color: #d4e3e5;
}

table.hovertable td {
	border-width: 1px;
	padding: 8px;
	border-style: solid;
	border-color: #a9c6c9;
}
</style>
</head>
<body>
	<form action="ShowReport" method="post">
		<input type="submit" value="生成报表">
	</form>
	<table class="hovertable">
		<tr>
			<th colspan="5">利润表</th>
		</tr>
		<tr>
			<th>序号</th>
			<th>商品名称</th>
			<th>卖出数量</th>
			<th>交易笔数</th>
			<th>盈利额</th>
		</tr>
		<%
			List<Profit> list = null;
			if (session.getAttribute("PROFIT") != null) {
				int num = 0; //序号
				int tradingNum = 0; //卖出数量
				int times = 0; //交易单数
				int profits = 0; //盈利额
				list = (List<Profit>) session.getAttribute("PROFIT");
				if (list != null && list.size() > 0) {
					Profit pf;
					for (int i = 0; i < list.size(); ++i) {
						pf = list.get(i);
						num += 1;
						tradingNum += pf.getTradingNum();
						times += pf.getTime();
						profits += pf.getProfit();
		%>
		<tr onmousemove="this.style.backgroundColor='#ffff66';"
			onmouseout="this.style.backgroundColor='#d4e3e5';">
			<td><%=num%></td>
			<td><%=pf.getGoodsName()%></td>
			<td><%=pf.getTradingNum()%></td>
			<td><%=pf.getTime()%></td>
			<td><%=pf.getProfit()%></td>
		</tr>
		<%
			}
		%>
		<tr onmousemove="this.style.backgroundColor='#ffff66';"
			onmouseout="this.style.backgroundColor='#d4e3e5';">
			<td colspan="2">合计</td>
			<td><%=tradingNum%></td>
			<td><%=times%></td>
			<td><%=profits%></td>
		</tr>
		<%
			}
			}
		%>
	</table>
</body>
</html>